'''
Created on 26/03/2009

@author: eh01
'''
from im.handler.sendtohubhandler import SendToHubHandler
from im.ds.dst import DST
from im.ds import dsconstants
from im.ds.dso import DSO
import unittest


class Test(unittest.TestCase):


    def setUp(self):
        pass


    def tearDown(self):
        pass


    def test_send_to_hub_handler_case1(self):
        send_to_hub_handler = SendToHubHandler()
        dst1 = DST(subject=dsconstants.SUBJECT_ROOT, 
                  predicate=dsconstants.PREDICATE_MESSAGE_TYPE, 
                  literal="connectivity_test")
        dst2 = DST(subject=dsconstants.SUBJECT_ROOT,
                  predicate=dsconstants.PREDICATE_MESSAGE_DESTINATION_NODE, 
                  literal="spear")
        dst3 = DST(subject=dsconstants.SUBJECT_ROOT, 
                  predicate=dsconstants.PREDICATE_MESSAGE_CONTENT, 
                  object=dsconstants.SUBJECT_MESSAGE_CONTENT)
        dst4 = DST(subject=dsconstants.SUBJECT_MESSAGE_CONTENT, 
                  predicate=dsconstants.PREDICATE_TEST_STRING, 
                  literal="hello world")
        dst5 = DST(subject=dsconstants.SUBJECT_ROOT, 
                  predicate=dsconstants.PREDICATE_HTTP_REQUEST, 
                  literal="DUMMY HTTP REQUEST OBJECT")
        dst6 = DST(subject=dsconstants.SUBJECT_ROOT, 
                  predicate=dsconstants.PREDICATE_LOCK, 
                  literal="DUMMY LOCK")                    
        dso = DSO([dst1, dst2, dst3, dst4, dst5, dst6])
        send_to_hub_handler.do(dso)

if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()